/*
 * MineralRateDatabase.h
 *
 *  Created on: 15 Jul 2011
 *      Author: al2010
 */

#ifndef MINERALRATEDATABASE_H_
#define MINERALRATEDATABASE_H_

// C++ includes
#include <list>
using namespace std;

// Boost includes
#include <boost/optional.hpp>
using boost::optional;

// GeoReact includes
#include "../Utils.h"
#include "../MineralReaction.h"

struct MineralRateInfo
{
	/// The name of the mineral whose the rate information is defined for
	String mineralName;
	
	/// The specific surface area of the mineral
	double specificSurfaceArea;
	
	/// The mineral rate mechanisms of the mineral dissolution/precipitation reaction
	vector<MineralReaction::Mechanism> mechanisms;
};

class MineralRateDatabase
{
public:
	typedef list<MineralRateInfo>
	MineralRateInfoList;
	
public:
	static const MineralRateDatabase& 
	GetInstance();
	
	const MineralRateInfoList&
	GetMineralRateInfoList() const;
	
	const MineralRateInfo
	GetMineralRateInfo(const String& mineralName) const;
	
	const optional<MineralRateInfo>
	FindMineralRateInfo(const String& mineralName) const;
	
private:
	MineralRateDatabase();
	
	const double
	GetFromLineSpecificSurfaceArea(const String& surfAreaLine) const;
	
	const String
	GetFromLineMechanismName(const String& mechanismLine) const;
	
	const double
	GetFromLineRateConstant(const String& mechanismLine) const;
	
	const double
	GetFromLineActivationEnergy(const String& mechanismLine) const;
	
	const vector<MineralReaction::Catalyst>
	GetFromLineMineralRateCatalysts(const String& mechanismLine) const;
	
	const MineralReaction::Mechanism
	GetFromLineMineralRateMechanism(const String& mechanismLine) const;
	
private:
	MineralRateInfoList mineralRateInfoList;
};

#endif /* MINERALRATEDATABASE_H_ */
